#!/bin/bash

# C++ 三维重建服务构建脚本

set -e

echo "=== C++ 三维重建服务构建脚本 ==="

# 检查依赖
echo "检查依赖..."
if ! command -v cmake &> /dev/null; then
    echo "错误: 未找到 cmake，请先安装"
    exit 1
fi

if ! command -v make &> /dev/null; then
    echo "错误: 未找到 make，请先安装"
    exit 1
fi

# 创建构建目录
echo "创建构建目录..."
mkdir -p build

# 进入构建目录
cd build

# 运行 CMake
echo "运行 CMake..."
cmake .. -DCMAKE_BUILD_TYPE=Release

# 编译
echo "编译项目..."
make -j$(nproc)

echo "=== 构建完成 ==="
echo "可执行文件位置: build/reconstruction_service"
echo ""
echo "运行方式:"
echo "  ./build/reconstruction_service"
echo "  ./build/reconstruction_service --help"
echo ""
echo "Docker 构建:"
echo "  docker build -f Dockerfile.cpp -t reconstruction-service-cpp ."
echo "  docker run -d -p 8000:8000 reconstruction-service-cpp" 